package dao;

import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import pojo.Field;

import java.util.List;

/**
 * @author HLF
 * @date 2022/6/14 15:50
 */
public interface FieldDao {

    //主要可以获取到新增后的主键
    @Options(useGeneratedKeys = true, keyProperty = "fid", keyColumn = "fid")
    int insertField(Field field);


    List<Field> getAllFields();

    int deleteByFid(Integer fid);

    int updateField(Field field);


    Field getByFname(String fname);

    Field getByFid(Integer fid);

    @Update("update t_field set status = #{status} where fid = #{fid};")
    int updateStatusByFid(@Param("fid") Integer fid, @Param("status") Integer status);
}
